import axios from '@/util/request'
/**
 * 获取验证码
 * @param {*} sid 唯一标识
 */
const getCode = async (sid) => {
  return axios.get('/public/captcha', {
    params: {
      sid: sid
    }
  })
}

/**
 * 发送邮件
 * @param {*} options 邮箱
 */
const sendMail = async (options) => {
  return axios.post('/login/forget', options)
}
/**
 * 登录
 * @param {*} data 登录数据
 */
const login = (data) => {
  return axios.post('/login', data)
}
/**
 * 注册
 * @param {*} data  注册数据
 */
const reg = (data) => {
  return axios.post('/login/reg', data)
}

// 更新用户密码
const resetUserPass = (data) => {
  return axios.post('/login/reset-pass', data)
}
export { getCode, sendMail, login, reg, resetUserPass }
